﻿/*****************************************************************************
 * 弹出确认消息用户控件
 * 
 * 创建者             创建日期            版本         
 * hulei             2011-9-24            1.0
 * 
 * 
 * ****************************************************************************/

using System.Web.UI;
using System;
using System.Web.UI.WebControls;

namespace iOak.Web.BaseModuleControls
{

    /// <summary>
    /// 弹出确认消息用户控件
    /// </summary>
    public partial class ConfirmBox : UserControl
    {
        #region 显示消息
        /// <summary>
        /// 显示确认框

        /// </summary>
        public void Show()
        {
            modalPopupExtenderConfirm.Show();
        }
        #endregion

        #region 显示消息
        /// <summary>
        /// 显示消息
        /// </summary>
        /// <param name="message">显示消息内容</param>
        public void Show(string message)
        {
            ConfirmText = message;
            modalPopupExtenderConfirm.Show();
        }
        #endregion

        #region 回调脚本
        /// <summary>
        /// 回调脚本
        /// </summary>
        public string CallbackScript
        {
            set
            {
                confirmButtonExtenderConfirm.TargetControlID = buttonNone.ID;
                confirmButtonExtenderConfirm.DisplayModalPopupID = modalPopupExtenderNone.ID;
                modalPopupExtenderConfirm.OnOkScript = value;
            }
            get 
            {
                return modalPopupExtenderConfirm.OnOkScript;
            }
        }

        #endregion

        #region 获取消息标签
        /// <summary>
        /// 获取消息标签
        /// </summary>
        public Label MessageLabel
        {
            get 
            {
                return labelConfirmText;
            }
        }

        #endregion

        #region 确认消息
        /// <summary>
        /// 确认消息
        /// </summary>
        public string ConfirmText
        {
            set
            {
                labelConfirmText.Text = value;
            }
            get 
            {
                return labelConfirmText.Text;
            }
        }
        #endregion

        #region 确定按钮显示文本
        /// <summary>
        /// 确定按钮显示文本
        /// </summary>
        public string YesText
        {
            set
            {
                buttonYes.Text = value;
            }
            get 
            {
                return buttonYes.Text;
            }
        }
        #endregion

        #region 取消按钮显示文本
        /// <summary>
        /// 取消按钮显示文本
        /// </summary>
        public string NoText
        {
            set
            {
                buttonNo.Text = value;
            }
            get 
            {
                return buttonNo.Text;
            }
        }
        #endregion

        #region 控件ID
        /// <summary>
        /// 控件ID
        /// </summary>
        public string TargetControlId
        {
            set
            {
                confirmButtonExtenderConfirm.TargetControlID = value;
                if (String.IsNullOrWhiteSpace(modalPopupExtenderConfirm.OnOkScript)) 
                {
                    modalPopupExtenderConfirm.TargetControlID = value;
                }
            }
            get 
            {
                return modalPopupExtenderConfirm.TargetControlID;
            }
        }
        #endregion
    }
}